package com.py.credit.service.impl;

import com.py.credit.dao.ApplicationDao;
import com.py.credit.entity.Application;
import com.py.credit.entity.CheckReport;
import com.py.credit.service.ApplicationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ApplicationServiceImpl implements ApplicationService {

	@Autowired
	private ApplicationDao applicationDao;

	@Override
	public int addApplicationInfo(String applicant_unit, String tybm, String check_purpose, String applicat_date, int user_id,String username) {
		Application application = new Application();
		application.setApplicant_unit(applicant_unit);
		application.setTybm(tybm);
		application.setCheck_purpose(check_purpose);
		application.setApplicat_date(applicat_date);
		application.setUser_id(user_id);
		application.setUsername(username);
		applicationDao.addApplicationInfo(application);
		return application.getId();
	}

	@Override
	public Application selectApplicationInfo(int id) {
		return applicationDao.selectApplicationInfo(id);
	}
	
	@Override
	public CheckReport selectCheckReportInfo(int id) {
		return applicationDao.selectCheckReportInfo(id);
	}

	@Override
	public String selectTybmByQymc(String qymc) {
		return applicationDao.selectTybmByQymc(qymc);
	}

	@Override
	public void updateApplication(int id, String managerDate, String status, String pdfpath) {
		applicationDao.updateApplication(id, managerDate, status, pdfpath);
	}

	@Override
	public List<Application> selectApplicationInfoList(int userId) {
		return applicationDao.selectApplicationInfoList(userId);
	}

	@Override
	public int addCheck(String qymc, String tyshxydm, String fddbr, String lxr, String lxrdh, String yx, String purpose,
			Integer userId) {
		applicationDao.addCheck(qymc,tyshxydm,fddbr,lxr,lxrdh,yx,purpose,userId);
		return 0;
	}

	@Override
	public void updateCheckReport(int id, String checkTime, String checkStatus, String pdfpath) {
		applicationDao.updateCheckReport(id, checkTime, checkStatus, pdfpath);
		
	}

	@Override
	public List<CheckReport> selectCheckReportInfoList(int userId) {
		// TODO Auto-generated method stub
		return applicationDao.selectCheckReportInfoList(userId);
	}
}
